package com.example.day05.homework;

import java.util.Date;

public class SalariedEmployee extends  Employee{

    private  double monthSalary;


    public SalariedEmployee(String name, Date birthday, double monthSalary) {
        super(name, birthday);
        this.monthSalary = monthSalary;
    }

    public double getMonthSalary() {
        return monthSalary;
    }

    public void setMonthSalary(double monthSalary) {
        this.monthSalary = monthSalary;
    }

    @Override
    public   double getSalary(int month){
        if (this.getBirthday().getMonth()==month){
            this.setMonthSalary(this.getMonthSalary()+100);
        }
        return  this.getMonthSalary();
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("SalariedEmployee{");
        super.toString();
        sb.append("monthSalary=").append(monthSalary);
        sb.append('}');
        return sb.toString();
    }
}
